﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using Wpf_Client.Model;

namespace Wpf_Client.Converter
{
   public  class ConnectTypeToBoolConverter : IValueConverter
    {
       public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
       {
           ConnectType conType = (ConnectType) value;
            return conType == (ConnectType)int.Parse(parameter.ToString());
        }

       public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
       {
            bool isChecked = (bool)value;
            if (!isChecked)
            {
                return null;
            }
            return (ConnectType)int.Parse(parameter.ToString());
        }
    }
}
